package controllers

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"log"
	"net/http"
)

func UploadFile(c *gin.Context) {
	// 上传到本地
	file, _ := c.FormFile("file")
	log.Println(file.Filename)

	dst := "\\Users\\a\\Desktop\\week2d\\pkg\\img/" + file.Filename
	// 上传文件至指定的完整文件路径
	c.SaveUploadedFile(file, dst)

	c.String(http.StatusOK, fmt.Sprintf("'%s' uploaded!", dst))

}
